[PHP]: What does array_search() return if nothing was found?

Posted by Derek Adair on Stack Overflow See other posts from Stack Overflow or by Derek Adair
Published on 2010-04-05T22:43:06Z Indexed on 2010/04/05 22:53 UTC
Read the original article Hit count: 212

Filed under:
|
|

What does array_search() return if nothing was found?

I have the need for the following logic:

$found = array_search($needle, $haystack);

if($found){
  //do stuff
} else {
  //do different stuff
}

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays